# RUN: tfg-translate -graphdef-to-mlir %s | FileCheck %s

# Importing a "direct call" is converted into `tfg.LegacyCall` in MLIR.

# DISABLED-CHECK: %LegacyCall, %ctl_0 = tfg.LegacyCall(%Placeholder) device = "/job:localhost/replica:0/task:0/device:CPU:0" name = "y" {callee = #tfg.func<@XTimesTwo, {T = f32}>} : (tensor<*xf32>) -> (tensor<*xf32>)
# CHECK: tfg.func generic @XTimesTwo

node {
  name: "x"
  op: "Placeholder"
  device: "/job:localhost/replica:0/task:0/device:CPU:0"
  attr {
    key: "dtype"
    value {
      type: DT_FLOAT
    }
  }
  attr {
    key: "shape"
    value {
      shape {
        unknown_rank: true
      }
    }
  }
}
node {
  name: "y"
  op: "XTimesTwo"
  input: "x"
  device: "/job:localhost/replica:0/task:0/device:CPU:0"
  attr {
    key: "T"
    value {
      type: DT_FLOAT
    }
  }
}
node {
  name: "z"
  op: "Identity"
  input: "y"
  device: "/job:localhost/replica:0/task:0/device:CPU:0"
  attr {
    key: "T"
    value {
      type: DT_FLOAT
    }
  }
}
library {
  function {
    signature {
      name: "XTimesTwo"
      input_arg {
        name: "x"
        type_attr: "T"
      }
      output_arg {
        name: "y"
        type_attr: "T"
      }
      attr {
        name: "T"
        type: "type"
        allowed_values {
          list {
            type: DT_FLOAT
            type: DT_DOUBLE
            type: DT_INT32
            type: DT_INT64
          }
        }
      }
    }
    node_def {
      name: "two"
      op: "Const"
      attr {
        key: "dtype"
        value {
          type: DT_INT64
        }
      }
      attr {
        key: "value"
        value {
          tensor {
            dtype: DT_INT64
            tensor_shape {
            }
            int64_val: 2
          }
        }
      }
    }
    node_def {
      name: "scale"
      op: "Cast"
      input: "two:output:0"
      attr {
        key: "DstT"
        value {
          placeholder: "T"
        }
      }
      attr {
        key: "SrcT"
        value {
          type: DT_INT64
        }
      }
    }
    node_def {
      name: "y"
      op: "Mul"
      input: "x"
      input: "scale:y:0"
      attr {
        key: "T"
        value {
          placeholder: "T"
        }
      }
    }
    ret {
      key: "y"
      value: "y:z:0"
    }
  }
}
versions {
  producer: 762
}
